//
//  favCell.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-10-9.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "favCell.h"

@implementation favCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self makeViews];
    }
    return self;
}

-(void)makeViews
{
    
    self.backgroundView = [[UIView alloc]initWithFrame:self.bounds];
    self.backgroundView.layer.masksToBounds = YES;
    self.backgroundView.layer.borderWidth = .5f;
    self.backgroundView.backgroundColor = [UIColor whiteColor];
    self.backgroundView.layer.borderColor = UIColorFromRGB(0xcacaca).CGColor;
    
    [self addSubview: self.backgroundView];
    self.imageIV = [[UIImageView alloc] initWithFrame:CGRectMake(self.backgroundView.frame.origin.x, self.backgroundView.frame.origin.y, self.backgroundView.frame.size.width, self.backgroundView.frame.size.height)];
    //    _imageIV.contentMode = UIViewContentModeScaleAspectFit;
    //
    //    _imageIV.layer.rasterizationScale = [UIScreen mainScreen].scale;
    //    _imageIV.layer.shouldRasterize   = YES;
    //    _imageIV.clipsToBounds = YES;
    //    _imageIV.contentMode = UIViewContentModeScaleAspectFill;//跟微信一样 填
    _imageIV.contentMode = UIViewContentModeScaleToFill;
    [self.backgroundView addSubview:_imageIV];
    
    UIView *whiteView = [[UIView alloc]initWithFrame:CGRectMake(.5, height_y(self.backgroundView)-42, self.backgroundView.frame.size.width-1, 42.0f)];
    whiteView.backgroundColor = [UIColor whiteColor];
     [_imageIV addSubview:whiteView];
   
    
    
    self.taoCanNameLB = [[UILabel alloc]initWithFrame:CGRectMake(self.backgroundView.frame.origin.x, height_y(self.imageIV)-42, self.backgroundView.frame.size.width, 21)];
    self.taoCanNameLB.text =@"满月照A";
    self.taoCanNameLB.textAlignment = NSTextAlignmentCenter;
    self.taoCanNameLB.textColor = UIColorFromRGB(0x6f6862);
    self.taoCanNameLB.font = [UIFont systemFontOfSize:13.0f];
    [_imageIV addSubview:self.taoCanNameLB];
    
    self.taoCanPrice = [[UILabel alloc]initWithFrame:CGRectMake(self.backgroundView.frame.origin.x, height_y(self.taoCanNameLB)-3, self.backgroundView.frame.size.width, 21)];
    self.taoCanPrice.textAlignment = NSTextAlignmentCenter;
    self.taoCanPrice.text = @"1898";
    self.taoCanPrice.textColor = UIColorFromRGB(0x292522);
    self.taoCanPrice.font = [UIFont systemFontOfSize:13.0f];
    [_imageIV addSubview:self.taoCanPrice];
}

-(void)setDataDict:(NSDictionary *)dataDict
{
    if(_dataDict){
        _dataDict = nil;
    }
    _dataDict = dataDict;
    [self.imageIV sd_setImageWithURL:[NSURL URLWithString:self.dataDict[@"TopPhotoID"]] placeholderImage:ivDetaultImg];
    self.taoCanNameLB.text= self.dataDict[@"SeriesName"];
    self.taoCanPrice.text = [NSString stringWithFormat:@"%@元", self.dataDict[@"seriesprice"]];
}

@end
